<div id="update-contest-modal"
     class="modal fade"
     role="dialog"
     aria-labelledby="updateContestModalLabel"
     aria-hidden="true">

  <div class="modal-dialog primary-modal-dialog">
    <div class="modal-content">
      <div class="modal-header primary-modal-header d-flex align-items-center">
        <h4 class="modal-title flex-grow-1 text-center" id="updateContestModalLabel">
          <%= t("contest.update_contest_modal.heading") %>
        </h4>
        <button type="button"
                class="btn-close ms-auto"
                data-bs-dismiss="modal"
                aria-label="<%= t('contest.close') %>"></button>
      </div>

      <div class="modal-body">
        <p><%= t("contest.update_contest_modal.description") %></p>
      </div>

      <%= form_with url:   admin_contest_path(":contest_id"),
                    method: :patch,
                    scope:  :contest,
                    local:  true,
                    id:     "update-contest-form" do |form| %>

        <div class="modal-body">
          <div class="form-group">
            <%= form.label :deadline,
                           t("contest.update_contest_modal.sub_heading"),
                           for: "contest_deadline" %>

            <%= form.datetime_local_field :deadline,
                  class:    "form-control",
                  id:       "contest_deadline",
                  min:      Time.current.in_time_zone.strftime("%Y-%m-%dT%H:%M"),
                  value:    @contest.deadline&.in_time_zone&.strftime("%Y-%m-%dT%H:%M"),
                  required: true %>
          </div>
        </div>

        <div class="modal-footer">
          <%= form.submit t("contest.buttons.update_deadline"),
                          class: "btn btn-primary" %>
        </div>
      <% end %>
    </div>
  </div>
</div>
